package com.scorpio.goods.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.scorpio.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.scorpio.common.utils.treenode.TreeNode;
import com.scorpio.common.utils.treenode.TreeNodeType;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 商品类目对象 sc_goods_category
 *
 * @author scorpio
 * @date 2021-11-03
 */
@TableName("sc_goods_category")
public class GoodsCategoryEntity extends BaseEntity {
    private static final long serialVersionUID = 1L;

    //编号
    @TreeNode(TreeNodeType.ID)
    @TableId(type = IdType.AUTO)
    private Long id;

    //上级
    @TreeNode(TreeNodeType.ParentId)
    @NotNull(message = "无效上级")
    private Long pid;

    //类目
    @NotBlank(message = "类目不能为空")
    private String name;

    //图片
    private String image;

    //状态;0=正常,1=停用
    private String status;

    //是否删除
    private String isDelete;

    //层级
    private Integer level;

    @TableField(exist = false)
    private Integer maxLevel;

    @TableField(exist = false)
    @TreeNode(TreeNodeType.Children)
    private List<GoodsCategoryEntity> children;

    public List<GoodsCategoryEntity> getChildren() {
        return children;
    }

    public void setChildren(List<GoodsCategoryEntity> children) {
        this.children = children;
    }

    public Integer getMaxLevel() {
        return maxLevel;
    }

    public void setMaxLevel(Integer maxLevel) {
        this.maxLevel = maxLevel;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public Long getPid() {
        return pid;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getImage() {
        return image;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatus() {
        return status;
    }

    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }

    public String getIsDelete() {
        return isDelete;
    }
}
